<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf8"/>
    <title>WordProcessingML Support Module Functions - MarkLogic Server Online Documentation</title>
    <meta name="Homepage" content="server, administration, Mark Logic, xml, xquery, database"/>
    <meta name="Keywords" content="server, administration, Mark Logic, xml, xquery, database"/>
    <meta name="Description" content="WordProcessingML Support Module Functions - MarkLogic Server Online Documentation"/>
    <link href="images/admin.css" type="text/css" rel="stylesheet"/>
  </head>
  <body>
<form name="apidocs" action="apidocs.xqy" method="GET">
      <input type="hidden" name="fname" value="WordProcessingML Support"/>
      <table height="400" cellspacing="0" cellpadding="0" width="100%" border="0">
   <tr>
	 
	  <td valign="top" class="mainbody">
  <table cellspacing="0" cellpadding="0" border="0" width="100%">
    <tr valign="top" style="background-color: #a0002e">
		<td align="left" height="90" width="100%">
        <div><img src="images/varspace.gif" alt="" height="1" width="178"/></div>
        <div class="host-details" style="padding-left: 20px; padding-top: 10px">
          <div>This page was generated</div>
          <div>December&#160;30,&#160;2008</div>
          <div>5:50&#160;PM</div>
        </div>
      </td>
		<td align="left" width="420" valign="bottom" style="background-image: url(images/top-right-right-background.gif);                   background-repeat: no-repeat">
      <div><img src="images/varspace.gif" alt="" height="1" width="420"/></div>
      <div class="page-name" style="text-align: right; padding-right: 8px;        padding-bottom: 2px">XQuery Function Reference</div>
      </td>
	      </tr>
     <tr valign="top">
		<td colspan="3" align="left" height="100%" width="100%">
     <div><img src="images/varspace.gif" alt="" height="1" width="598"/></div>
  <table width="100%" align="center" cellspacing="1" cellpadding="4">
    <tr valign="top">
		      <td>
      <table width="100%">
      <tr align="center">
			    <td><br/>
      <font size="+1"><b>
      Module: WordProcessingML Support
      </b><br/></font>
      <br/>
      </td>
			  </tr>
 <tr>
			    <td style="font-family:arial;font-size:10pt">

      <p>The WordProcessingML function module is included in the Toolkit for Word zip package as the following 
		  file:</p>
    <ul>
				<li><code><em>zip_dir</em>/xquery/word-processing-ml-support.xqy</code></li>
			      </ul>
    <p>where <code><em>zip_dir</em></code> is the directory in which 
	    the Toolkit for Word was unzipped.</p>
    <p>To use the <code>word-processing-ml-support.xqy</code> module in your own 
    XQuery modules, 
    copy it to your App Server root and include a line similar to the following in your XQuery prolog:</p>
    <pre xml:space="preserve">
import module namespace ooxml="http://marklogic.com/openxml" 
	    at "/word-processing-ml-support.xqy";</pre>
    <p>The WordProcessingML functions are used to manipulate Microsoft Office
    Open XML documents.</p>
  
    </td>
			  </tr>
</table>
</td>
		    </tr>
   
  <tr>
		      <td>
      <table bgcolor="#000000" cellspacing="1" cellpadding="4" width="100%" align="center" class="table-line">
      <tr bgcolor="#f2ebce">
			    <td colspan="10">
          <font size="+1"><b>Function Summary</b></font>
        </td>
			  </tr>
      <tr class="mainbody">
			    <td style="font-family: arial; font-size: 10pt;">
          <a href="#ooxml:create-paragraph"><b>
            ooxml:create-paragraph
            </b></a> 
          </td>
			    <td style="font-family: arial; font-size: 10pt;">
          This function creates a w:p element 
		  from the specified string.
          </td>
			  </tr><tr class="mainbody">
			    <td style="font-family: arial; font-size: 10pt;">
          <a href="#ooxml:custom-xml"><b>
            ooxml:custom-xml
            </b></a> 
          </td>
			    <td style="font-family: arial; font-size: 10pt;">
          This function tags $content with 
		  w:customXml and sets the @element value
		  to $tag.
          </td>
			  </tr><tr class="mainbody">
			    <td style="font-family: arial; font-size: 10pt;">
          <a href="#ooxml:custom-xml-highlight"><b>
            ooxml:custom-xml-highlight
            </b></a> 
          </td>
			    <td style="font-family: arial; font-size: 10pt;">
          This function highlights $hightlight-term in $nodes 
		  by applying &lt;w:customXml w:element={$tag-name}&gt;
		  to the term.
          </td>
			  </tr><tr class="mainbody">
			    <td style="font-family: arial; font-size: 10pt;">
          <a href="#ooxml:get-custom-xml-ancestor"><b>
            ooxml:get-custom-xml-ancestor
            </b></a> 
          </td>
			    <td style="font-family: arial; font-size: 10pt;">
          This function returns the greatest ancestor of the 
		  specified node that is either an immediate parent of 
		  type w:customXml or w:sdt, a
		  parent of that parent, and so on until the parent is not
		  a w:customXml or w:sdt
		  element.
          </td>
			  </tr><tr class="mainbody">
			    <td style="font-family: arial; font-size: 10pt;">
          <a href="#ooxml:get-paragraph-style-id"><b>
            ooxml:get-paragraph-style-id
            </b></a> 
          </td>
			    <td style="font-family: arial; font-size: 10pt;">
          This function returns the @val attribute for
		  a w:pStyle element (child of
		  w:pPr) from $pstyle.
          </td>
			  </tr><tr class="mainbody">
			    <td style="font-family: arial; font-size: 10pt;">
          <a href="#ooxml:get-paragraph-styles"><b>
            ooxml:get-paragraph-styles
            </b></a> 
          </td>
			    <td style="font-family: arial; font-size: 10pt;">
          This function returns the paragraph 
		  properties.
          </td>
			  </tr><tr class="mainbody">
			    <td style="font-family: arial; font-size: 10pt;">
          <a href="#ooxml:get-run-style-id"><b>
            ooxml:get-run-style-id
            </b></a> 
          </td>
			    <td style="font-family: arial; font-size: 10pt;">
          This function returns the values for the attribute
		  @val for a w:rStyle element (which is a child 
		  of a w:rPr element).
          </td>
			  </tr><tr class="mainbody">
			    <td style="font-family: arial; font-size: 10pt;">
          <a href="#ooxml:get-run-styles"><b>
            ooxml:get-run-styles
            </b></a> 
          </td>
			    <td style="font-family: arial; font-size: 10pt;">
          This function returns paragraph run 
		  styles.
          </td>
			  </tr><tr class="mainbody">
			    <td style="font-family: arial; font-size: 10pt;">
          <a href="#ooxml:get-style-definition"><b>
            ooxml:get-style-definition
            </b></a> 
          </td>
			    <td style="font-family: arial; font-size: 10pt;">
          This function returns the style definition from 
		  styles.xml for the given style ID.
          </td>
			  </tr><tr class="mainbody">
			    <td style="font-family: arial; font-size: 10pt;">
          <a href="#ooxml:remove-paragraph-styles"><b>
            ooxml:remove-paragraph-styles
            </b></a> 
          </td>
			    <td style="font-family: arial; font-size: 10pt;">
          This function removes all properties from 
		  w:p paragraphs.
          </td>
			  </tr><tr class="mainbody">
			    <td style="font-family: arial; font-size: 10pt;">
          <a href="#ooxml:replace-custom-xml-element"><b>
            ooxml:replace-custom-xml-element
            </b></a> 
          </td>
			    <td style="font-family: arial; font-size: 10pt;">
          This function replaces any @element values for 
		  w:customXml with $newtag, where 
		  w:customXml[@w:element = $oldtag].
          </td>
			  </tr><tr class="mainbody">
			    <td style="font-family: arial; font-size: 10pt;">
          <a href="#ooxml:replace-paragraph-styles"><b>
            ooxml:replace-paragraph-styles
            </b></a> 
          </td>
			    <td style="font-family: arial; font-size: 10pt;">
          This function sets paragraph properties for 
		  paragraphs (w:p) within a 
		  block.
          </td>
			  </tr><tr class="mainbody">
			    <td style="font-family: arial; font-size: 10pt;">
          <a href="#ooxml:replace-run-styles"><b>
            ooxml:replace-run-styles
            </b></a> 
          </td>
			    <td style="font-family: arial; font-size: 10pt;">
          This function sets run properties for 
		  runs (w:r) within a 
		  block.
          </td>
			  </tr><tr class="mainbody">
			    <td style="font-family: arial; font-size: 10pt;">
          <a href="#ooxml:replace-style-definition"><b>
            ooxml:replace-style-definition
            </b></a> 
          </td>
			    <td style="font-family: arial; font-size: 10pt;">
          This function replaces w:style 
		  elements (style definitions) in w:styles 
		  (the styles.xml file from a .docx package).
          </td>
			  </tr>
      </table>
      </td>
		    </tr><tr>
		      <td><img src="images/varspace.gif" height="10"/></td>
		    </tr><tr>
		      <td>
      <table bgcolor="#000000" cellspacing="1" cellpadding="4" width="100%" align="right" class="table-line">
      <tr bgcolor="#f2ebce">
			    <td colspan="10">
          <font size="+1"><b>Function Detail</b></font>
        </td>
			  </tr>
      <tr class="mainbody">
			    <td>
       <table border="0" width="100%" class="mainbody" cellspacing="0" cellpadding="0">

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/>
      </td>
				</tr>

        <tr class="mainbody">
				  <td>

            <table>
            <tr>
					<td colspan="2" style="font-size:12pt;font-family:Courier">
                 <a id="ooxml:create-paragraph"></a><b><font color="#c00831">
                 ooxml:create-paragraph</font></b>(
                    </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $para as xs:string
                      </td>
				      </tr><tr>
					<td colspan="2" style="font-size:11pt;font-family:Courier">)&#160; as &#160;element(w:p)</td>
				      </tr>
            </table>

          </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/></td>
				</tr>

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
          <img src="images/varspace.gif" width="8"/>
          <b>Summary:</b>
          <div style="margin-left:.5in; margin-right:8px; font-family:arial;                        font-size:10pt"> <br/>
            This function creates a <code>w:p</code> element 
		  from the specified string.
          </div><br/>
          </td>
				</tr>
        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
    <img src="images/varspace.gif" width="8"/>
    <b>Parameters:</b>
      <table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $para
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The text of the 
		    paragraph.
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><br/>
    </td>
				</tr>
 
        

        

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
          at "/MarkLogic/openxml/word-processing-ml.xqy";

ooxml:create-paragraph("Hello there everyone.")

=&gt; 
&lt;w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
   &lt;w:r&gt;&lt;w:t&gt;Hello there everyone.&lt;/w:t&gt;&lt;/w:r&gt;
&lt;/w:p&gt;
  
  </pre>
  
            </div>
            </td>
				</tr>

        <tr class="mainbody">
				  <td></td>
				</tr>
        </table><table border="0" width="100%" class="mainbody" cellspacing="0" cellpadding="0">

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/>
      <hr class="control-line" size="1"/></td>
				</tr>

        <tr class="mainbody">
				  <td>

            <table>
            <tr>
					<td colspan="2" style="font-size:12pt;font-family:Courier">
                 <a id="ooxml:custom-xml"></a><b><font color="#c00831">
                 ooxml:custom-xml</font></b>(
                    </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $content as element(), 
                      </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $tag as xs:string
                      </td>
				      </tr><tr>
					<td colspan="2" style="font-size:11pt;font-family:Courier">)&#160; as &#160;element(w:customXml)?</td>
				      </tr>
            </table>

          </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/></td>
				</tr>

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
          <img src="images/varspace.gif" width="8"/>
          <b>Summary:</b>
          <div style="margin-left:.5in; margin-right:8px; font-family:arial;                        font-size:10pt"> <br/>
            This function tags $content with 
		  <code>w:customXml</code> and sets the @element value
		  to $tag.
	  
          </div><br/>
          </td>
				</tr>
        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
    <img src="images/varspace.gif" width="8"/>
    <b>Parameters:</b>
      <table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $content
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The content 
		    element.
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $tag
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The name of the 
		    custom XML tag.
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><br/>
    </td>
				</tr>
 
        

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
        <img src="images/varspace.gif" width="8"/>
        <b>Usage Notes:</b>
            <div style="margin-left:.5in; margin-right:8px; font-family:arial;                          font-size:10pt">
            <br/>
              The $content parameter must either be an element of type 
	    paragraph (w:p) , run (w:r), field (w:fldSimple,w:fldChar), 
	    hyperlink (w:hyperlink), custom xml (w:customXml), structured 
	    document tag (w:sdt), table (w:tbl), cel (w:tc), or row (w:tr).  
	    If it is not one of these types, the function 
	    returns the empty sequence.
            </div><br/>
        </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
		  at "MarkLogic/openxml/word-processing-ml.xqy";

let $para:= 
  &lt;w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
       &lt;w:r&gt;&lt;w:t&gt;This is my paragraph.&lt;/w:t&gt;&lt;/w:r&gt;
  &lt;/w:p&gt;
let $tag := "ABCD"
return ooxml:custom-xml($para,$tag)
=&gt;
&lt;w:customXml w:element="ABCD" 
  xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
  &lt;w:p&gt;&lt;w:r&gt;&lt;w:t&gt;This is my paragraph.&lt;/w:t&gt;&lt;/w:r&gt;&lt;/w:p&gt;
&lt;/w:customXml&gt;
</pre>
  
            </div>
            </td>
				</tr>

        <tr class="mainbody">
				  <td></td>
				</tr>
        </table><table border="0" width="100%" class="mainbody" cellspacing="0" cellpadding="0">

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/>
      <hr class="control-line" size="1"/></td>
				</tr>

        <tr class="mainbody">
				  <td>

            <table>
            <tr>
					<td colspan="2" style="font-size:12pt;font-family:Courier">
                 <a id="ooxml:custom-xml-highlight"></a><b><font color="#c00831">
                 ooxml:custom-xml-highlight</font></b>(
                    </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $nodes as node()*, 
                      </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $highlight-term as cts:query, 
                      </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $tag-name as xs:string, 
                      </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      [$attributes as xs:string*], 
                      </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      [$values as xs:string*]
                      </td>
				      </tr><tr>
					<td colspan="2" style="font-size:11pt;font-family:Courier">)&#160; as &#160;node()*</td>
				      </tr>
            </table>

          </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/></td>
				</tr>

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
          <img src="images/varspace.gif" width="8"/>
          <b>Summary:</b>
          <div style="margin-left:.5in; margin-right:8px; font-family:arial;                        font-size:10pt"> <br/>
            This function highlights $hightlight-term in $nodes 
		  by applying &lt;w:customXml w:element={$tag-name}&gt;
		  to the term. It searches for term within 
		  <code>w:t</code> elements within a <code>w:r</code> 
		  (runs), wrapping a customXml element around the element
		  the element containing the highlighted match.
	  
          </div><br/>
          </td>
				</tr>
        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
    <img src="images/varspace.gif" width="8"/>
    <b>Parameters:</b>
      <table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $nodes
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The paragraph(s) from 
		    which to search for the highlighted terms.
	    
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $highlight-term
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The 
		    <code>cts:query</code> used to find the 
		    highlight term.
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $tag-name
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The
		    name used for the <code>w:customXml w:element</code> 
		    attribute value.
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $attributes
                   <font style="font-size:10pt;font-family:Arial"> 
                       (optional)</font>:
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 
		    A list of attributes to be added to the
		    <code>w:customXml</code> properties.
	    
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $values
                   <font style="font-size:10pt;font-family:Arial"> 
                       (optional)</font>:
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 
		    The values corresponding to the $attributes.
	    
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><br/>
    </td>
				</tr>
 
        

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
        <img src="images/varspace.gif" width="8"/>
        <b>Usage Notes:</b>
            <div style="margin-left:.5in; margin-right:8px; font-family:arial;                          font-size:10pt">
            <br/>
              
	    If you specify the $attributes and $values parameters, the length 
	    of the list for each parameter must be the same, otherwise an
	    exception is thrown.
    
            </div><br/>
        </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
		  at "MarkLogic/openxml/word-processing-ml.xqy";

declare namespace w=
  "http://schemas.openxmlformats.org/wordprocessingml/2006/main";

let $wp := &lt;w:p&gt;&lt;w:r&gt;&lt;w:t&gt;THIS IS A TEST!&lt;/w:t&gt;&lt;/w:r&gt;&lt;/w:p&gt;
let $wordquery := cts:word-query("TEST")
return  ooxml:custom-xml-highlight($wp,$wordquery,"MYTAG")
=&gt;
&lt;w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
  &lt;w:r&gt;
    &lt;w:t xml:space="preserve"&gt;THIS IS A &lt;/w:t&gt;
  &lt;/w:r&gt;
  &lt;w:customXml w:element="MYTAG"&gt;
   &lt;w:r&gt;
     &lt;w:t&gt;TEST&lt;/w:t&gt;
   &lt;/w:r&gt;
  &lt;/w:customXml&gt;
  &lt;w:r&gt;
    &lt;w:t xml:space="preserve"&gt;!&lt;/w:t&gt;
  &lt;/w:r&gt;
&lt;/w:p&gt;
  
</pre>
  
            </div>
            </td>
				</tr><tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
		  at "MarkLogic/openxml/word-processing-ml.xqy";

declare namespace w=
  "http://schemas.openxmlformats.org/wordprocessingml/2006/main";

let $wp := &lt;w:p&gt;&lt;w:r&gt;&lt;w:t&gt;THIS IS A TEST!&lt;/w:t&gt;&lt;/w:r&gt;&lt;/w:p&gt;
let $wordquery := cts:word-query("TEST")
let $attributes := ("author","id")
let $values := ("oslo","1") 
return  ooxml:custom-xml-highlight($wp,$wordquery,"MYTAG", $attributes, $values)
=&gt;
&lt;w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
  &lt;w:r&gt;
    &lt;w:t xml:space="preserve"&gt;THIS IS A &lt;/w:t&gt;
  &lt;/w:r&gt;
  &lt;w:customXml w:element="MYTAG"&gt;
    &lt;w:customXmlPr&gt;
      &lt;w:attr w:name="author" w:val="oslo"/&gt;
      &lt;w:attr w:name="id" w:val="1"/&gt;
    &lt;/w:customXmlPr&gt;
    &lt;w:r&gt;
      &lt;w:t&gt;TEST&lt;/w:t&gt;
    &lt;/w:r&gt;
  &lt;/w:customXml&gt;
  &lt;w:r&gt;
    &lt;w:t xml:space="preserve"&gt;!&lt;/w:t&gt;
  &lt;/w:r&gt;
&lt;/w:p&gt;
  
</pre>
  
            </div>
            </td>
				</tr>

        <tr class="mainbody">
				  <td></td>
				</tr>
        </table><table border="0" width="100%" class="mainbody" cellspacing="0" cellpadding="0">

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/>
      <hr class="control-line" size="1"/></td>
				</tr>

        <tr class="mainbody">
				  <td>

            <table>
            <tr>
					<td colspan="2" style="font-size:12pt;font-family:Courier">
                 <a id="ooxml:get-custom-xml-ancestor"></a><b><font color="#c00831">
                 ooxml:get-custom-xml-ancestor</font></b>(
                    </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $doc as element()
                      </td>
				      </tr><tr>
					<td colspan="2" style="font-size:11pt;font-family:Courier">)&#160; as &#160;element()?</td>
				      </tr>
            </table>

          </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/></td>
				</tr>

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
          <img src="images/varspace.gif" width="8"/>
          <b>Summary:</b>
          <div style="margin-left:.5in; margin-right:8px; font-family:arial;                        font-size:10pt"> <br/>
            This function returns the greatest ancestor of the 
		  specified node that is either an immediate parent of 
		  type <code>w:customXml</code> or <code>w:sdt</code>, a
		  parent of that parent, and so on until the parent is not
		  a <code>w:customXml</code> or <code>w:sdt</code>
		  element.  If no such ancestor is found, then the empty 
		  sequence is returned.
	  
          </div><br/>
          </td>
				</tr>
        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
    <img src="images/varspace.gif" width="8"/>
    <b>Parameters:</b>
      <table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $doc
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 An element to 
		    search.
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><br/>
    </td>
				</tr>
 
        

        

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
		  at "MarkLogic/openxml/word-processing-ml.xqy";
declare namespace w=
  "http://schemas.openxmlformats.org/wordprocessingml/2006/main";

let $para:= 
 &lt;w:p&gt;
   &lt;w:r&gt;&lt;w:t&gt;THIS IS A TEST!&lt;/w:t&gt;&lt;/w:r&gt;
 &lt;/w:p&gt;
let $custom := 
  &lt;w:customXml w:element="foo"&gt;
    &lt;w:customXml w:element="bar"&gt;{$para}&lt;/w:customXml&gt;
  &lt;/w:customXml&gt;
let $wp1 := $custom//w:p
return  ooxml:get-custom-xml-ancestor($wp1)
=&gt;
&lt;w:customXml w:element="foo" 
  xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
 &lt;w:customXml w:element="bar"&gt;
	&lt;w:p&gt;&lt;w:r&gt;&lt;w:t&gt;THIS IS A TEST!&lt;/w:t&gt;&lt;/w:r&gt;&lt;/w:p&gt;
 &lt;/w:customXml&gt;
&lt;/w:customXml&gt;


  </pre>
  
            </div>
            </td>
				</tr>

        <tr class="mainbody">
				  <td></td>
				</tr>
        </table><table border="0" width="100%" class="mainbody" cellspacing="0" cellpadding="0">

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/>
      <hr class="control-line" size="1"/></td>
				</tr>

        <tr class="mainbody">
				  <td>

            <table>
            <tr>
					<td colspan="2" style="font-size:12pt;font-family:Courier">
                 <a id="ooxml:get-paragraph-style-id"></a><b><font color="#c00831">
                 ooxml:get-paragraph-style-id</font></b>(
                    </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $pstyle as element(w:pPr)
                      </td>
				      </tr><tr>
					<td colspan="2" style="font-size:11pt;font-family:Courier">)&#160; as &#160;xs:string?</td>
				      </tr>
            </table>

          </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/></td>
				</tr>

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
          <img src="images/varspace.gif" width="8"/>
          <b>Summary:</b>
          <div style="margin-left:.5in; margin-right:8px; font-family:arial;                        font-size:10pt"> <br/>
            This function returns the @val attribute for
		  a <code>w:pStyle</code> element (child of
		  <code>w:pPr</code>) from $pstyle. Returns the empty sequence
		  if no IDs are found.
	  
          </div><br/>
          </td>
				</tr>
        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
    <img src="images/varspace.gif" width="8"/>
    <b>Parameters:</b>
      <table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $pstyle
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The 
		    <code>w:pPr</code> element.
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><br/>
    </td>
				</tr>
 
        

        

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
		  at "MarkLogic/openxml/word-processing-ml.xqy";

declare namespace w=
  "http://schemas.openxmlformats.org/wordprocessingml/2006/main";

let $pstyle:= 
       &lt;w:pPr&gt;
             &lt;w:pStyle w:val="TestParagraphStyle" /&gt;
             &lt;w:ind w:left="1440" /&gt;
        &lt;/w:pPr&gt;
return ooxml:get-paragraph-style-id($pstyle)

=&gt; TestParagraphStyle
</pre>
  
            </div>
            </td>
				</tr>

        <tr class="mainbody">
				  <td></td>
				</tr>
        </table><table border="0" width="100%" class="mainbody" cellspacing="0" cellpadding="0">

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/>
      <hr class="control-line" size="1"/></td>
				</tr>

        <tr class="mainbody">
				  <td>

            <table>
            <tr>
					<td colspan="2" style="font-size:12pt;font-family:Courier">
                 <a id="ooxml:get-paragraph-styles"></a><b><font color="#c00831">
                 ooxml:get-paragraph-styles</font></b>(
                    </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $paragraph as element(w:p)*
                      </td>
				      </tr><tr>
					<td colspan="2" style="font-size:11pt;font-family:Courier">)&#160; as &#160;element(w:pPr)*</td>
				      </tr>
            </table>

          </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/></td>
				</tr>

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
          <img src="images/varspace.gif" width="8"/>
          <b>Summary:</b>
          <div style="margin-left:.5in; margin-right:8px; font-family:arial;                        font-size:10pt"> <br/>
            This function returns the paragraph 
		  properties.  Returns the empty sequence
		  if no styles are found.
          </div><br/>
          </td>
				</tr>
        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
    <img src="images/varspace.gif" width="8"/>
    <b>Parameters:</b>
      <table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $paragraph
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The w:p 
		    element(s).
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><br/>
    </td>
				</tr>
 
        

        

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
		  at "MarkLogic/openxml/word-processing-ml.xqy";

let $wp := 
&lt;w:p  xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
  &lt;w:pPr&gt;&lt;w:u/&gt;&lt;/w:pPr&gt;
  &lt;w:r&gt;&lt;w:t&gt;This is a test.&lt;/w:t&gt;&lt;/w:r&gt;
&lt;/w:p&gt;
return ooxml:get-paragraph-styles($wp)
=&gt;
&lt;w:pPr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
	&lt;w:u/&gt;
&lt;/w:pPr&gt;
  </pre>
  
            </div>
            </td>
				</tr>

        <tr class="mainbody">
				  <td></td>
				</tr>
        </table><table border="0" width="100%" class="mainbody" cellspacing="0" cellpadding="0">

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/>
      <hr class="control-line" size="1"/></td>
				</tr>

        <tr class="mainbody">
				  <td>

            <table>
            <tr>
					<td colspan="2" style="font-size:12pt;font-family:Courier">
                 <a id="ooxml:get-run-style-id"></a><b><font color="#c00831">
                 ooxml:get-run-style-id</font></b>(
                    </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $rstyle as element(w:rPr)
                      </td>
				      </tr><tr>
					<td colspan="2" style="font-size:11pt;font-family:Courier">)&#160; as &#160;xs:string?</td>
				      </tr>
            </table>

          </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/></td>
				</tr>

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
          <img src="images/varspace.gif" width="8"/>
          <b>Summary:</b>
          <div style="margin-left:.5in; margin-right:8px; font-family:arial;                        font-size:10pt"> <br/>
            This function returns the values for the attribute
		  @val for a <code>w:rStyle</code> element (which is a child 
		  of a <code>w:rPr</code> element). Returns the empty sequence
		  if no IDs are found.
	  
          </div><br/>
          </td>
				</tr>
        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
    <img src="images/varspace.gif" width="8"/>
    <b>Parameters:</b>
      <table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $rstyle
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The 
		    <code>w:rPr</code> element 
		    containing the <code>w:rStyle</code> element.
	    
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><br/>
    </td>
				</tr>
 
        

        

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
		  at "MarkLogic/openxml/word-processing-ml.xqy";

let $rstyle := 
&lt;w:rPr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
        &lt;w:rStyle w:val="oslo"/&gt;&lt;w:u/&gt;
&lt;/w:rPr&gt;
return ooxml:get-run-style-id($rstyle)
=&gt;
oslo
</pre>
  
            </div>
            </td>
				</tr>

        <tr class="mainbody">
				  <td></td>
				</tr>
        </table><table border="0" width="100%" class="mainbody" cellspacing="0" cellpadding="0">

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/>
      <hr class="control-line" size="1"/></td>
				</tr>

        <tr class="mainbody">
				  <td>

            <table>
            <tr>
					<td colspan="2" style="font-size:12pt;font-family:Courier">
                 <a id="ooxml:get-run-styles"></a><b><font color="#c00831">
                 ooxml:get-run-styles</font></b>(
                    </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $paragraph as element(w:p)*
                      </td>
				      </tr><tr>
					<td colspan="2" style="font-size:11pt;font-family:Courier">)&#160; as &#160;element(w:rPr)*</td>
				      </tr>
            </table>

          </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/></td>
				</tr>

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
          <img src="images/varspace.gif" width="8"/>
          <b>Summary:</b>
          <div style="margin-left:.5in; margin-right:8px; font-family:arial;                        font-size:10pt"> <br/>
            This function returns paragraph run 
		  styles. Returns the empty sequence
		  if no styles are found.
          </div><br/>
          </td>
				</tr>
        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
    <img src="images/varspace.gif" width="8"/>
    <b>Parameters:</b>
      <table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $paragraph
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The w:p 
		    element(s).
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><br/>
    </td>
				</tr>
 
        

        

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
		  at "MarkLogic/openxml/word-processing-ml.xqy";


let $wp := 
&lt;w:p  xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
  &lt;w:pPr&gt;&lt;w:u/&gt;&lt;/w:pPr&gt;
  &lt;w:r&gt;
      &lt;w:rPr&gt;&lt;w:b/&gt;&lt;/w:rPr&gt;
      &lt;w:t&gt;This is a test.&lt;/w:t&gt;
   &lt;/w:r&gt;
  &lt;w:r&gt;
      &lt;w:rPr&gt;&lt;w:i/&gt;&lt;/w:rPr&gt;
      &lt;w:t&gt;This is another.&lt;/w:t&gt;
   &lt;/w:r&gt;
&lt;/w:p&gt;
return ooxml:get-run-styles($wp)
=&gt;
&lt;w:rPr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
	&lt;w:b/&gt;
&lt;/w:rPr&gt;
&lt;w:rPr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
	&lt;w:i/&gt;
&lt;/w:rPr&gt;

</pre>
  
            </div>
            </td>
				</tr>

        <tr class="mainbody">
				  <td></td>
				</tr>
        </table><table border="0" width="100%" class="mainbody" cellspacing="0" cellpadding="0">

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/>
      <hr class="control-line" size="1"/></td>
				</tr>

        <tr class="mainbody">
				  <td>

            <table>
            <tr>
					<td colspan="2" style="font-size:12pt;font-family:Courier">
                 <a id="ooxml:get-style-definition"></a><b><font color="#c00831">
                 ooxml:get-style-definition</font></b>(
                    </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $styleid as xs:string, 
                      </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $styles as element(w:styles)
                      </td>
				      </tr><tr>
					<td colspan="2" style="font-size:11pt;font-family:Courier">)&#160; as &#160;element(w:style)?</td>
				      </tr>
            </table>

          </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/></td>
				</tr>

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
          <img src="images/varspace.gif" width="8"/>
          <b>Summary:</b>
          <div style="margin-left:.5in; margin-right:8px; font-family:arial;                        font-size:10pt"> <br/>
            This function returns the style definition from 
		  styles.xml for the given style ID.
	  
          </div><br/>
          </td>
				</tr>
        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
    <img src="images/varspace.gif" width="8"/>
    <b>Parameters:</b>
      <table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $styleid
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The style ID.
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $styles
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The root
	      element from the styles.xml file in the .docx 
	      package.
      
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><br/>
    </td>
				</tr>
 
        

        

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
		  at "MarkLogic/openxml/word-processing-ml.xqy";
declare namespace w=
  "http://schemas.openxmlformats.org/wordprocessingml/2006/main";

let $styleids := "oslo"
let $styles := doc("/Test_docx_parts/word/styles.xml") 
return ooxml:get-style-definitions($styleids, $styles)/w:style
=&gt;
&lt;w:style xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
       	w:type="character" w:customStyle="1" w:styleId="oslo"&gt;
     &lt;w:name w:val="oslo"/&gt;&lt;w:basedOn w:val="Emphasis"/&gt;
     &lt;w:uiPriority w:val="1"/&gt;&lt;w:qFormat/&gt;&lt;w:rsid w:val="005B2E7B"/&gt;
       &lt;w:rPr&gt;&lt;w:rFonts w:ascii="Bodoni MT Black" w:hAnsi="Bodoni MT Black"/&gt;
       &lt;w:b/&gt;&lt;w:sz w:val="32"/&gt;&lt;/w:rPr&gt;
&lt;/w:style&gt;

</pre>
  
            </div>
            </td>
				</tr>

        <tr class="mainbody">
				  <td></td>
				</tr>
        </table><table border="0" width="100%" class="mainbody" cellspacing="0" cellpadding="0">

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/>
      <hr class="control-line" size="1"/></td>
				</tr>

        <tr class="mainbody">
				  <td>

            <table>
            <tr>
					<td colspan="2" style="font-size:12pt;font-family:Courier">
                 <a id="ooxml:remove-paragraph-styles"></a><b><font color="#c00831">
                 ooxml:remove-paragraph-styles</font></b>(
                    </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $paragraph as element()
                      </td>
				      </tr><tr>
					<td colspan="2" style="font-size:11pt;font-family:Courier">)&#160; as &#160;element()</td>
				      </tr>
            </table>

          </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/></td>
				</tr>

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
          <img src="images/varspace.gif" width="8"/>
          <b>Summary:</b>
          <div style="margin-left:.5in; margin-right:8px; font-family:arial;                        font-size:10pt"> <br/>
            This function removes all properties from 
		  <code>w:p</code> paragraphs. Paragraph properties are 
		  <code>w:pPr</code> elements and run properties are 
		  <code>w:rPr</code> elements.
	  
          </div><br/>
          </td>
				</tr>
        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
    <img src="images/varspace.gif" width="8"/>
    <b>Parameters:</b>
      <table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $paragraph
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 Any block-level
	    element.
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><br/>
    </td>
				</tr>
 
        

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
        <img src="images/varspace.gif" width="8"/>
        <b>Usage Notes:</b>
            <div style="margin-left:.5in; margin-right:8px; font-family:arial;                          font-size:10pt">
            <br/>
              This function is useful when you want to insert a 
	    paragraph with the Office defaults, or when you want to 
	    switch the existing properties for a paragraph.
            </div><br/>
        </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
		  at "MarkLogic/openxml/word-processing-ml.xqy";

let $paragraph:=
&lt;w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
  &lt;w:pPr&gt;&lt;w:b/&gt;&lt;/w:pPr&gt;
     &lt;w:r&gt;&lt;w:rPr&gt;&lt;w:u/&gt;&lt;/w:rPr&gt;
             &lt;w:t&gt;This is a test.&lt;/w:t&gt;
      &lt;/w:r&gt;&lt;/w:p&gt;
return ooxml:remove-paragraph-styles($paragraph)
=&gt;
&lt;w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
	&lt;w:r&gt;&lt;w:t&gt;This is a test.&lt;/w:t&gt;&lt;/w:r&gt;
&lt;/w:p&gt;

</pre>
  
            </div>
            </td>
				</tr>

        <tr class="mainbody">
				  <td></td>
				</tr>
        </table><table border="0" width="100%" class="mainbody" cellspacing="0" cellpadding="0">

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/>
      <hr class="control-line" size="1"/></td>
				</tr>

        <tr class="mainbody">
				  <td>

            <table>
            <tr>
					<td colspan="2" style="font-size:12pt;font-family:Courier">
                 <a id="ooxml:replace-custom-xml-element"></a><b><font color="#c00831">
                 ooxml:replace-custom-xml-element</font></b>(
                    </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $content as element(), 
                      </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $oldtag as xs:string, 
                      </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $newtag as xs:string
                      </td>
				      </tr><tr>
					<td colspan="2" style="font-size:11pt;font-family:Courier">)&#160; as &#160;element()</td>
				      </tr>
            </table>

          </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/></td>
				</tr>

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
          <img src="images/varspace.gif" width="8"/>
          <b>Summary:</b>
          <div style="margin-left:.5in; margin-right:8px; font-family:arial;                        font-size:10pt"> <br/>
            This function replaces any @element values for 
		  <code>w:customXml</code> with $newtag, where 
		  <code>w:customXml[@w:element = $oldtag]</code>.
	  
          </div><br/>
          </td>
				</tr>
        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
    <img src="images/varspace.gif" width="8"/>
    <b>Parameters:</b>
      <table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $content
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The OOXML 
		    content.
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $oldtag
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The old tag for the 
	      element name.
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $newtag
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The new tag for the 
	      element name.
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><br/>
    </td>
				</tr>
 
        

        

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
		  at "MarkLogic/openxml/word-processing-ml.xqy";

declare namespace w=
  "http://schemas.openxmlformats.org/wordprocessingml/2006/main";

let $block:=
&lt;w:customXml w:element="ABCD"&gt;
    &lt;w:p&gt;
&lt;w:r&gt;&lt;w:t&gt;This is my paragraph.&lt;/w:t&gt;&lt;/w:r&gt;
         &lt;/w:p&gt;
&lt;/w:customXml&gt;
let $origtag := "ABCD"
let $newtag := "EFGH"
return ooxml:replace-custom-xml-element($block,$origtag,$newtag)
=&gt;
&lt;w:customXml w:element="EFGH" 
  xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
  &lt;w:p&gt;&lt;w:r&gt;&lt;w:t&gt;This is my paragraph.&lt;/w:t&gt;&lt;/w:r&gt;&lt;/w:p&gt;
&lt;/w:customXml&gt;
</pre>
  
            </div>
            </td>
				</tr>

        <tr class="mainbody">
				  <td></td>
				</tr>
        </table><table border="0" width="100%" class="mainbody" cellspacing="0" cellpadding="0">

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/>
      <hr class="control-line" size="1"/></td>
				</tr>

        <tr class="mainbody">
				  <td>

            <table>
            <tr>
					<td colspan="2" style="font-size:12pt;font-family:Courier">
                 <a id="ooxml:replace-paragraph-styles"></a><b><font color="#c00831">
                 ooxml:replace-paragraph-styles</font></b>(
                    </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $block as element(), 
                      </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $wpProps as element(w:pPr)?
                      </td>
				      </tr><tr>
					<td colspan="2" style="font-size:11pt;font-family:Courier">)&#160; as &#160;element()</td>
				      </tr>
            </table>

          </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/></td>
				</tr>

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
          <img src="images/varspace.gif" width="8"/>
          <b>Summary:</b>
          <div style="margin-left:.5in; margin-right:8px; font-family:arial;                        font-size:10pt"> <br/>
            This function sets paragraph properties for 
		  paragraphs (<code>w:p</code>) within a 
		  block.  If the empty sequence is passed for $wpProps, then
		  the paragraph properties for the $block are
		  removed.
          </div><br/>
          </td>
				</tr>
        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
    <img src="images/varspace.gif" width="8"/>
    <b>Parameters:</b>
      <table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $block
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The block containing 
		    the paragraph to be updated.
	    
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $wpProps
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The paragraph
		    properties, as a w:pPr element, to be applied within the
		    paragraph block. 
	    
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><br/>
    </td>
				</tr>
 
        

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
        <img src="images/varspace.gif" width="8"/>
        <b>Usage Notes:</b>
            <div style="margin-left:.5in; margin-right:8px; font-family:arial;                          font-size:10pt">
            <br/>
              
	    <p>If $block already has styles applied, these styles are replaced 
		    by the new style parameters.  If the empty sequence is 
		    passed for $wpProps, the paragraph properties for the 
		    $block are removed.  If there are no properties currently 
		    defined for the paragraph, the $wpProps are applied.</p>
	    <p>
	    Note that this function does not validate that the 
	    <code>w:pPr</code> element passed in is valid, so make sure the
	    element you pass in is valid WordProcessingML markup.  If you pass
	    in an invalid element, it could result in a document that
	    cannot be opened in Microsoft Word.
	    </p>
	    
    
            </div><br/>
        </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
		  at "MarkLogic/openxml/word-processing-ml.xqy";
declare namespace w=
  "http://schemas.openxmlformats.org/wordprocessingml/2006/main";

let $wp1 := 
&lt;w:p&gt;
     &lt;w:r&gt;&lt;w:t&gt;THIS IS A TEST!&lt;/w:t&gt;&lt;/w:r&gt;
&lt;/w:p&gt;
let $pPr := &lt;w:pPr&gt;&lt;w:b/&gt;&lt;/w:pPr&gt;
return  ooxml:replace-paragraph-styles($wp1,$pPr)
=&gt;
&lt;w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
	&lt;w:pPr&gt;
		&lt;w:b/&gt;
        &lt;/w:pPr&gt;
	&lt;w:t&gt;THIS IS A TEST!&lt;/w:t&gt;
&lt;/w:p&gt;

</pre>
  
            </div>
            </td>
				</tr>

        <tr class="mainbody">
				  <td></td>
				</tr>
        </table><table border="0" width="100%" class="mainbody" cellspacing="0" cellpadding="0">

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/>
      <hr class="control-line" size="1"/></td>
				</tr>

        <tr class="mainbody">
				  <td>

            <table>
            <tr>
					<td colspan="2" style="font-size:12pt;font-family:Courier">
                 <a id="ooxml:replace-run-styles"></a><b><font color="#c00831">
                 ooxml:replace-run-styles</font></b>(
                    </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $block as element(), 
                      </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $wrProps as element(w:rPr)?
                      </td>
				      </tr><tr>
					<td colspan="2" style="font-size:11pt;font-family:Courier">)&#160; as &#160;element()</td>
				      </tr>
            </table>

          </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/></td>
				</tr>

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
          <img src="images/varspace.gif" width="8"/>
          <b>Summary:</b>
          <div style="margin-left:.5in; margin-right:8px; font-family:arial;                        font-size:10pt"> <br/>
            This function sets run properties for 
		  runs (<code>w:r</code>) within a 
		  block.  If the empty sequence is passed for $wrProps, then
		  the paragraph properties for the $block are
		  removed.
          </div><br/>
          </td>
				</tr>
        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
    <img src="images/varspace.gif" width="8"/>
    <b>Parameters:</b>
      <table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $block
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The block containing 
		    the run to be updated.
	    
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $wrProps
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The run
		    properties, as a w:rPr element, to be applied within the
		    run block. 
	    
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><br/>
    </td>
				</tr>
 
        

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
        <img src="images/varspace.gif" width="8"/>
        <b>Usage Notes:</b>
            <div style="margin-left:.5in; margin-right:8px; font-family:arial;                          font-size:10pt">
            <br/>
              
	    Note that this function does not validate that the 
	    <code>w:rPr</code> element passed in is valid, so make sure the
	    element you pass in is valid WordProcessingML markup.  If you pass
	    in an invalid element, it could result in a document that
	    cannot be opened in Microsoft Word.
    
            </div><br/>
        </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
		  at "MarkLogic/openxml/word-processing-ml.xqy";
declare namespace w=
  "http://schemas.openxmlformats.org/wordprocessingml/2006/main";

let $wp1 := 
&lt;w:p&gt;
     &lt;w:r&gt;&lt;w:t&gt;THIS IS A TEST!&lt;/w:t&gt;&lt;/w:r&gt;
&lt;/w:p&gt;
let $rPr := &lt;w:rPr&gt;&lt;w:b/&gt;&lt;/w:rPr&gt;
return  ooxml:replace-run-styles($wp1,$rPr)
=&gt;
&lt;w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
  &lt;w:r&gt;
    &lt;w:rPr&gt;
      &lt;w:b/&gt;
    &lt;/w:rPr&gt;
    &lt;w:t&gt;THIS IS A TEST!&lt;/w:t&gt;
  &lt;/w:r&gt;
&lt;/w:p&gt;	

</pre>
  
            </div>
            </td>
				</tr>

        <tr class="mainbody">
				  <td></td>
				</tr>
        </table><table border="0" width="100%" class="mainbody" cellspacing="0" cellpadding="0">

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/>
      <hr class="control-line" size="1"/></td>
				</tr>

        <tr class="mainbody">
				  <td>

            <table>
            <tr>
					<td colspan="2" style="font-size:12pt;font-family:Courier">
                 <a id="ooxml:replace-style-definition"></a><b><font color="#c00831">
                 ooxml:replace-style-definition</font></b>(
                    </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $newstyle as element(w:style), 
                      </td>
				      </tr><tr>
					<td width="20"></td>
					<td style="font-size:11pt;font-family:Courier">
                      $styles as element(w:styles)
                      </td>
				      </tr><tr>
					<td colspan="2" style="font-size:11pt;font-family:Courier">)&#160; as &#160;element(w:styles)</td>
				      </tr>
            </table>

          </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" height="12"/></td>
				</tr>

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
          <img src="images/varspace.gif" width="8"/>
          <b>Summary:</b>
          <div style="margin-left:.5in; margin-right:8px; font-family:arial;                        font-size:10pt"> <br/>
            This function replaces <code>w:style</code> 
		  elements (style definitions) in <code>w:styles</code> 
		  (the styles.xml file from a .docx package).
          </div><br/>
          </td>
				</tr>
        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
    <img src="images/varspace.gif" width="8"/>
    <b>Parameters:</b>
      <table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $newstyle
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The new style
	    element.
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><table>
          <tr class="mainbody">
					<td style="font-size:11pt;font-family:Arial">
               <img src="images/varspace.gif" width="8"/>
                 <div style="margin-left:.5in; margin-right:8px">
                 <font style="font-size:11pt;font-family:Courier">
                   $styles
                   :
                 </font>
                 <font style="font-family:arial;font-size:10pt">
                 The old styles 
	    element (from styles.xml).
                 </font>
                 </div> 
            </td>
				      </tr>
         </table><br/>
    </td>
				</tr>
 
        

        <tr class="mainbody">
				  <td style="font-size:10pt;font-family:Arial">
        <img src="images/varspace.gif" width="8"/>
        <b>Usage Notes:</b>
            <div style="margin-left:.5in; margin-right:8px; font-family:arial;                          font-size:10pt">
            <br/>
              
      <p>If the id for the style $newstyle matches a style definition already 
	      present in $styles, the $newstyle will replace the existing 
	      style.</p>
      <p>If the id for the style $newstyle does not exist in $styles, the 
	      $newstyle definition will be appended to the other 
	      definitions in $styles.</p>
      <p>Note that it is possible within Microsoft Word to create styles 
	      with names that differ only in their case that have different 
	      style attributes. For example,
	      you can create two styles: "mystyle" and "MYSTYLE", which
	      have completely different style definitions.</p>
	    
    
            </div><br/>
        </td>
				</tr>

        <tr class="mainbody">
				  <td><img src="images/varspace.gif" width="8"/>
            <font style="font-size:10pt;font-family:Arial"><b>Example:</b></font>
            <div style="margin-left:.5in; margin-right:8px; font-size:9pt;                          font-family:Courier"> 
            <pre xml:space="preserve">
xquery version "1.0-ml";
import module namespace ooxml= "http://marklogic.com/openxml" 
		  at "MarkLogic/openxml/word-processing-ml.xqy";

let $oldstyle := 
 &lt;w:styles 
  xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
  &lt;w:style w:type="character" w:customStyle="1" w:styleId="oslo"&gt;
     &lt;w:name w:val="oslo"/&gt;&lt;w:basedOn w:val="Emphasis"/&gt;
     &lt;w:uiPriority w:val="1"/&gt;&lt;w:qFormat/&gt;&lt;w:rsid w:val="005B2E7B"/&gt;
       &lt;w:rPr&gt;&lt;w:rFonts w:ascii="Bodoni MT Black" w:hAnsi="Bodoni MT Black"/&gt;
       &lt;w:b/&gt;&lt;w:sz w:val="32"/&gt;&lt;/w:rPr&gt;
   &lt;/w:style&gt;
 &lt;/w:styles&gt;
let $newstyle :=
  &lt;w:style 
   xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
   w:type="character" w:customStyle="1" w:styleId="oslo"&gt;
     &lt;w:name w:val="oslo"/&gt;&lt;w:basedOn w:val="Emphasis"/&gt;
     &lt;w:uiPriority w:val="1"/&gt;&lt;w:qFormat/&gt;&lt;w:rsid w:val="005B2E7B"/&gt;
       &lt;w:rPr&gt;&lt;w:rFonts w:ascii="Courier New" w:hAnsi="Courier New"/&gt;
       &lt;w:b/&gt;&lt;w:sz w:val="32"/&gt;&lt;/w:rPr&gt;
   &lt;/w:style&gt;
return
ooxml:replace-style-definition($newstyle, $oldstyle)
=&gt;
&lt;w:styles 
  xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"&gt;
  &lt;w:style w:type="character" w:customStyle="1" w:styleId="oslo"&gt;
    &lt;w:name w:val="oslo"/&gt;&lt;w:basedOn w:val="Emphasis"/&gt;
    &lt;w:uiPriority w:val="1"/&gt;&lt;w:qFormat/&gt;&lt;w:rsid w:val="005B2E7B"/&gt;
    &lt;w:rPr&gt;&lt;w:rFonts w:ascii="Courier New" w:hAnsi="Courier New"/&gt;
      &lt;w:b/&gt;
      &lt;w:sz w:val="32"/&gt;
    &lt;/w:rPr&gt;
  &lt;/w:style&gt;
&lt;/w:styles&gt;
</pre>
  
            </div>
            </td>
				</tr>

        <tr class="mainbody">
				  <td></td>
				</tr>
        </table>
       </td>
			  </tr>
      </table>
      </td>
		    </tr>
  </table>
    </td>
	      </tr>
  </table>
  </td>
	</tr>
</table>
      <table cellspacing="0" cellpadding="0" width="100%" align="left" border="0"><tr height="30" valign="middle">
	  <td class="copyright" style="padding-left: 10px">
        &#169; Copyright 2002-2008 Mark Logic Corporation.&#160;&#160;All rights reserved.
      </td>
	</tr></table>
    </form>
</body>
</html>
